import openpyxl
import ast
import yaml

file = openpyxl.load_workbook('interface_testcase.xlsx')

data = file.worksheets[2]

temp_data = {}

lines = 0
for i in data.values:
    lines = lines+1
    if lines == 1:
        continue
    request_data = ast.literal_eval(i[4])  # {"id": "2"}
    request_data['excepts'] = int(i[6])    # {'id': '2', 'excepts': 0}
    temp_data[i[2]] = request_data
    print(temp_data)


f = open('./jinrong_data.ymal', 'w', encoding='utf-8')  # 打开文件
yaml.dump(temp_data, f, allow_unicode=True)  # 将数据写入
f.close()  # 关闭文件
